import 'package:flutter_jd/models/blog_model.dart';
import 'package:flutter_jd/tools/utils/library.dart';

// 博客 Api
class BlogApi {
  // 获取博客列表
  // static Future<List<BlogModel>> getBlogList(int currentPage) async {
  static Future getBlogList(int currentPage) async {
    String url = "/api/getBlogList?currentPage=$currentPage";
    final res = await HttpUtil.request(url);

    List<BlogModel> blogList = [];

    for (var blog in res['data']) {
      blogList.add(BlogModel.fromJson(blog));
    }

    return res;
  }
}
